package com.jk.smartelderlycare.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jk.smartelderlycare.dto.SysRole;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Description 添加描述
 * @Author hhk
 * @LastChangeDate 2024/11/6 20:30
 * @Version v1.0
 */
public interface SysRoleMapper extends BaseMapper<SysRole> {

    /** 
     * @description: 查询角色列表
     * @param: [sysRole]
     * @return: java.util.List<com.jk.smartelderlycare.dto.SysRole>
     * @author hhk
     * @date: 2024/11/7 11:51
     */
    IPage<SysRole> findSysSysRolePaginationList(@Param(value = "sysRole") SysRole sysRole, Page<SysRole> page);
    /**
     * @description: 删除中间表
     * @param: [roleId]
     * @return: void
     * @author hhk
     * @date: 2024/11/7 14:56
     */
    @Delete("delete from sys_user_role where role_id = #{roleId}")
    void deleteRoleAndUserByRoleId(Long roleId);
    /**
     * @description: 状态修改
     * @param: [sysRole]
     * @return: void
     * @author hhk
     * @date: 2024/11/7 16:47
     */
    @Update("update sys_role set  status = #{status} where role_id = #{roleId}")
    void updateStatusById(SysRole sysRole);
}
